//1.引入异步对象
import request from '@/utils/request'
console.log("[HMZreq]",request);
import type {AttrValueInfoModel,AttrInfoModel} from './model/attrModel'
import type {CategoryIdsModel} from './model/categorySelect'
//2.使用枚举接口储存地址
enum Api {
    //获取属性列表
    getAttrListApi = '/admin/product/attrInfoList',
    //删除属性
    deleteAttrApi = '/admin/product/deleteAttr',
    //编辑增加属性
    saveAttrInfoApi = '/admin/product/saveAttrInfo',
}
//3.定义接口函数 获取属性列表
export const reqGetAttrListDataByCategory3Id = ({category1ID,category2ID,category3ID}:CategoryIdsModel) =>{
    console.log("[hhh]",category3ID);
    
    return request.get<any,AttrValueInfoModel>(`${Api.getAttrListApi}/${category1ID}/${category2ID}/${category3ID}`)
}
//4.删除属性
export const reqDeleteOneAttr = (attrID:number)=>{
    return request.delete(Api.deleteAttrApi + `/${attrID}`)
}
//编辑数据增加
export const reqEditAttrList = (attr:Object)=>{
    return request.post<any,null>(Api.saveAttrInfoApi,attr)
}
